package com.bw.wjw.function;


import com.bw.wjw.bean.PageViewBean;
import org.apache.flink.api.common.functions.ReduceFunction;

public class PageViewReportReduceFunction implements ReduceFunction<PageViewBean> {

    @Override
    public PageViewBean reduce(PageViewBean tmp, PageViewBean bean) throws Exception {

        tmp.setPvCount(tmp.getPvCount() + bean.getPvCount());
        tmp.setPvDuringTime(tmp.getPvDuringTime() + bean.getPvDuringTime());
        tmp.setUvCount(tmp.getUvCount() + bean.getUvCount());
        tmp.setSessionCount(tmp.getSessionCount() + bean.getSessionCount());
        // 2返回结果
        return tmp;
    }
}
